<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>过户信息</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <c:if test="${'5' == flag}">
            <div class="searchArea" id="addBtnDiv">
                <span id="addBtn" class="sq-button sq-button-round">添加过户信息</span>
            </div>
        </c:if>
        <div id="ligergrid1" class="sq-grid"></div>
    </div>
</div>

<script type="text/javascript">

    // 格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    var grid = null;
    var dealId = '${dealId}';
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/ass/dealcar/manage/initTransInfoList.do?dealId=' + dealId,
            method: 'get',
            columns: [
                {display: '支付表号', name: 'paySchNo', minWidth: 60, align: 'center', enabledSort: false},
                {display: '承租人', name: 'cstNm', minWidth: 100, align: 'center', enabledSort: false},
                {display: '过户项目', name: 'categoryNm', minWidth: 60, align: 'center', enabledSort: false},
                {
                    display: '创建时间', name: 'crtTm', minWidth: 100, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value) {
                        return renderDate(rowdata, rowindex, value);
                    }
                },
                {display: '过户进度', name: 'scheduleNm', minWidth: 80, align: 'center', enabledSort: false},
                {
                    display: '过户资料', name: 'courtTm', minWidth: 80, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value) {
                        var h = '';
                        h += '<a href="javascript:showTransInfoFiles(';
                        h += "'" + rowdata.id + "'";
                        h += ",'ASS_TRANSFER_INFO'";
                        h += ')">查看</a>';
                        return h;
                    }
                },
                {display: '过户金额', name: 'amount', minWidth: 80, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value) {
                        return rowdata.amount / 100;
                    }
                },
                {
                    display: '预计完成时间', name: 'estimateTime', minWidth: 80, align: 'center', enabledSort: false,
                    render: function (rowdata, rowindex, value) {
                        return renderDate(rowdata, rowindex, value);
                    }
                },
                {display: '备注', name: 'remark', minWidth: 160, align: 'center', enabledSort: false}
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });
        grid.setHeight(100);

        /* 添加诉讼记录 */
        $("#addBtn").click(function (event) {
            var prjId = "${prjId}";
            var url = '<%=path%>/ass/dealcar/manage/toAddAssTransInfo.do?dealId=' + dealId;
            var title = '添加过户记录';
            $.ligerDialog.open({
                width: 1200,
                height: 500,
                title: title,
                url: url
            });
        });
    });

    /**
     * 过户信息资料查看
     * @param id
     * @param tableNm
     */
    function showTransInfoFiles(id, tableNm) {
        var url = '<%=path%>/ass/dealcar/manage/toAssDealCarFilePage.do?id=' + id + '&tableNm=' + tableNm;
        var title = '查看诉讼资料';
        $.ligerDialog.open({
            width: 1200,
            height: 400,
            title: title,
            url: url
        });
    }

</script>

</body>
</html>
